package pip.can;

import java.util.LinkedList;

public class Queue {
	public LinkedList<Message> Queue;
	private int delays;
	public Queue()
	{
		Queue= new LinkedList<Message>();
		delays=0;
	}
	public void addPacket(Message mes)
	{
		Queue.add(mes);
	}
	public Message getPacket()
	{
		if((Queue.getFirst().size)>(delays+1)*StaticVariables.RoundRobinPar)
		{
			delays++;
			return null;
		}
		else
		{
			delays=0;
			return Queue.removeFirst();
		}
	}
	public boolean isEmpty()
	{
		if(Queue.size()==0)
		{
			return true;
		}
		else
		{
			return false;
		}
	}

}
